<template>
	<view class="home">
		<view class="text-32 text-bold">拼桌前需输入你的号码进行绑定</view>
		<view class="flex align-center margin-top-25 bg-ff bg-shadow padding-30 radius-40">
			<view class="text-28">号码</view>
			<input type="text" placeholder="请输入号码" class="text-28 flex-one text-right" v-model="code" />
			<view class="tyIcon-arrow-right text-24"></view>
		</view>
		<view class="subbtn" @click="getPin">去拼桌</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code: ""
			}
		},
		methods: {
			getPin() {
				if (this.code == '') {
					this.cn.alert('请输入灯号')
					return false
				}
				this.rq.getData('order/light', {
					shop_id: uni.getStorageSync('store_id'),
					code: this.code
				}).then(res => {
					if (res.code == 1) {
						uni.setStorageSync('lampid', res.data.id)
						this.cn.alert('绑定灯号成功').then(res => {
							uni.redirectTo({
								url:'/pages/board/orderlist'
							})
						})
					}
				})
			}
		}
	}
</script>

<style>
	.home {
		width: 100%;
		min-height: 100vh;
		background: #fff;
		padding: 40rpx 30rpx;
	}

	.subbtn {
		width: 690rpx;
		height: 88rpx;
		background: #101010;
		box-shadow: 0rpx 16rpx 80rpx 0rpx rgba(66, 66, 67, 0.25);
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		font-size: 32rpx;
		color: #FFFFFF;
		line-height: 88rpx;
		text-align: center;
		position: fixed;
		bottom: 252rpx;
		left: 30rpx;
		right: 30rpx;
	}
</style>